Optimal. Leaf size=70 \[ x \left (a^2 B+2 a A b-b^2 B\right )+\frac {a^2 A \log (\sin (c+d x))}{d}-\frac {b (2 a B+A b) \log (\cos (c+d x))}{d}+\frac {b^2 B \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.11, antiderivative size = 70, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.103, Rules used = {3606, 3624, 3475} \[ x \left (a^2 B+2 a A b-b^2 B\right )+\frac {a^2 A \log (\sin (c+d x))}{d}-\frac {b (2 a B+A b) \log (\cos (c+d x))}{d}+\frac {b^2 B \tan (c+d x)}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3606
Rule 3624
Rubi steps
\begin {align*} \int \cot (c+d x) (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx &=\frac {b^2 B \tan (c+d x)}{d}+\int \cot (c+d x) \left (a^2 A+\left (2 a A b+\left (a^2-b^2\right ) B\right ) \tan (c+d x)+\left (A b^2+2 a b B\right ) \tan ^2(c+d x)\right ) \, dx\\ &=\left (2 a A b+a^2 B-b^2 B\right ) x+\frac {b^2 B \tan (c+d x)}{d}+\left (a^2 A\right ) \int \cot (c+d x) \, dx+(b (A b+2 a B)) \int \tan (c+d x) \, dx\\ &=\left (2 a A b+a^2 B-b^2 B\right ) x-\frac {b (A b+2 a B) \log (\cos (c+d x))}{d}+\frac {a^2 A \log (\sin (c+d x))}{d}+\frac {b^2 B \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 0.28, size = 93, normalized size = 1.33 \[ -\frac {-2 a^2 A \log (\tan (c+d x))+(a+i b)^2 (A+i B) \log (-\tan (c+d x)+i)+(a-i b)^2 (A-i B) \log (\tan (c+d x)+i)-2 b B (a+b \tan (c+d x))}{2 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.63, size = 92, normalized size = 1.31 \[ \frac {A a^{2} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, B b^{2} \tan \left (d x + c\right ) + 2 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} d x - {\left (2 \, B a b + A b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.99, size = 86, normalized size = 1.23 \[ \frac {2 \, A a^{2} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 2 \, B b^{2} \tan \left (d x + c\right ) + 2 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} {\left (d x + c\right )} - {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.38, size = 109, normalized size = 1.56 \[ 2 A x a b +a^{2} B x -B x \,b^{2}-\frac {A \,b^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {a^{2} A \ln \left (\sin \left (d x +c \right )\right )}{d}+\frac {2 A a b c}{d}+\frac {b^{2} B \tan \left (d x +c \right )}{d}-\frac {2 B a b \ln \left (\cos \left (d x +c \right )\right )}{d}+\frac {B \,a^{2} c}{d}-\frac {B \,b^{2} c}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.84, size = 85, normalized size = 1.21 \[ \frac {2 \, A a^{2} \log \left (\tan \left (d x + c\right )\right ) + 2 \, B b^{2} \tan \left (d x + c\right ) + 2 \, {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} {\left (d x + c\right )} - {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.37, size = 90, normalized size = 1.29 \[ \frac {A\,a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (A-B\,1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^2}{2\,d}+\frac {B\,b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (A+B\,1{}\mathrm {i}\right )\,{\left (-b+a\,1{}\mathrm {i}\right )}^2}{2\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 0.69, size = 129, normalized size = 1.84 \[ \begin {cases} - \frac {A a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {A a^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 2 A a b x + \frac {A b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + B a^{2} x + \frac {B a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - B b^{2} x + \frac {B b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\relax (c )}\right ) \left (a + b \tan {\relax (c )}\right )^{2} \cot {\relax (c )} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________